package com.zm.controller;


import com.zm.domain.Account;
import com.zm.services.IAccountServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/account")
public class AccountController {

    @Autowired
    IAccountServices accountServices;

    @RequestMapping("/findAllAccount")
    public String findAllAccount(Model model){
        System.out.println("表现成mvc成功");
        List<Account> allAccount = accountServices.findAllAccount();
        model.addAttribute("allAccount",allAccount);
        return "list";
    }
    @RequestMapping("/saveAccount")
    public String saveAccount(Account account){
        System.out.println("表现成mvc成功");
        System.out.println(account);
        accountServices.saveAccount(account);
        return "forward:/account/findAllAccount";
    }

}
